package com.yuno.mock.exception;

/**
 * Excel读取异常
 * 
 * @author yuno
 * @since 2024-01-01
 */
public class ExcelReadException extends RuntimeException {

    private String errorCode;
    private String filePath;
    private String sheetName;
    private Integer rowNumber;
    private Integer columnNumber;

    public ExcelReadException(String message) {
        super(message);
    }

    public ExcelReadException(String message, Throwable cause) {
        super(message, cause);
    }

    public ExcelReadException(String errorCode, String message) {
        super(message);
        this.errorCode = errorCode;
    }

    public ExcelReadException(String errorCode, String message, Throwable cause) {
        super(message, cause);
        this.errorCode = errorCode;
    }

    public ExcelReadException(String errorCode, String message, String filePath) {
        super(message);
        this.errorCode = errorCode;
        this.filePath = filePath;
    }

    public ExcelReadException(String errorCode, String message, String filePath, String sheetName) {
        super(message);
        this.errorCode = errorCode;
        this.filePath = filePath;
        this.sheetName = sheetName;
    }

    public ExcelReadException(String errorCode, String message, String filePath, String sheetName, Integer rowNumber, Integer columnNumber) {
        super(message);
        this.errorCode = errorCode;
        this.filePath = filePath;
        this.sheetName = sheetName;
        this.rowNumber = rowNumber;
        this.columnNumber = columnNumber;
    }

    // Getters
    public String getErrorCode() {
        return errorCode;
    }

    public String getFilePath() {
        return filePath;
    }

    public String getSheetName() {
        return sheetName;
    }

    public Integer getRowNumber() {
        return rowNumber;
    }

    public Integer getColumnNumber() {
        return columnNumber;
    }

    // Setters
    public void setErrorCode(String errorCode) {
        this.errorCode = errorCode;
    }

    public void setFilePath(String filePath) {
        this.filePath = filePath;
    }

    public void setSheetName(String sheetName) {
        this.sheetName = sheetName;
    }

    public void setRowNumber(Integer rowNumber) {
        this.rowNumber = rowNumber;
    }

    public void setColumnNumber(Integer columnNumber) {
        this.columnNumber = columnNumber;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("ExcelReadException{");
        sb.append("errorCode='").append(errorCode).append('\'');
        sb.append(", message='").append(getMessage()).append('\'');
        if (filePath != null) {
            sb.append(", filePath='").append(filePath).append('\'');
        }
        if (sheetName != null) {
            sb.append(", sheetName='").append(sheetName).append('\'');
        }
        if (rowNumber != null) {
            sb.append(", rowNumber=").append(rowNumber);
        }
        if (columnNumber != null) {
            sb.append(", columnNumber=").append(columnNumber);
        }
        sb.append('}');
        return sb.toString();
    }
}